<%@ page pageEncoding="ISO-8859-1" contentType="text/html; charset=ISO-8859-1" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<script type="text/javascript" src="scripts/defscripts.js"></script>
<fmt:setBundle basename="MessageResources"/>

<form name="elementForm" method="post" action="${param['formAction']}">
	<table border="0" cellpadding="1" align="center">
		<tr>
			<td align="right"><fmt:message key="drug.scientificName"/>:</td>
			<td><input name="element.scientificName" type="text" size="30" value="${element.scientificName}"></td>
		</tr>
		<tr>
			<td align="right"><fmt:message key="drug.commercialName"/>:</td>
			<td><input name="element.commercialName" type="text" size="30" value="${element.commercialName}"></td>
		</tr>
		<tr>
			<td align="right"><fmt:message key="drug.owner"/>:</td>
			<td><input name="element.owner" type="text" size="30" value="${element.owner}"></td>
		</tr>
		<tr>
			<td align="right" valign="top"><fmt:message key="drug.compositions"/>:</td>
			<td>
				<input name="compositionsListSize" type="hidden" id="compositionsListSize" value="0">
				<fmt:message key="drug.composition.description"/> / <fmt:message key="drug.composition.quantity"/> / <fmt:message key="drug.composition.unit"/><br>
				<div id="compositionsList"></div>
				<input name="addCompositionButton" type="button" value="<fmt:message key='drug.register.form.addCompositionButton.label'/>" onclick="addComposition('compositionsList','compositionsListSize','compositionDescription','compositionQuantity','compositionUnit')">
				<script type="text/javascript">
					for (i = 0; i < 5; i++) document.elementForm.addCompositionButton.click();
					<c:forEach items="${element.compositions}" var="eachComposition" varStatus="eachId">
						if (${eachId.count - 1} >= document.elementForm.compositionsListSize.value) document.elementForm.addSymptomButton.click();
						document.elementForm.compositionDescription${eachId.count - 1}.value = ${eachComposition.description};
						document.elementForm.compositionQuantity${eachId.count - 1}.value = ${eachComposition.quantity};
						document.elementForm.compositionUnit${eachId.count - 1}.value = ${eachComposition.unit};
					</c:forEach>
				</script>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input name="submit" type="submit" value="<fmt:message key='element.form.submit.label'/>">
				<input name="clear" type="reset" value="<fmt:message key='element.form.clear.label'/>">
				<input name="back" type="button" value="<fmt:message key='element.form.back.label'/>" onclick="location.href='${backPage}'">
			</td>
		</tr>
	</table>
</form>
